<?php

namespace app\components;

use yii\web\AssetBundle;

class AppAsset extends AssetBundle {

    public $basePath = '@webroot/assets';
    public $baseUrl = '@web/assets';
    public $css = [
        'web/css/index.css',
        'web/css/main.css',
    ];
    public $js = [];

    public $depends = [
        'app\assets\MuiAsset',
        'yii\web\JqueryAsset',
    ];

    public function init() {
        parent::init();
        $route = \Yii::$app->controller->route;
        if (in_array($route, ['activity/index', 'post/index'])) {
            $this->css[] = 'common/swiper/swiper.min.css';
            $this->js[] = 'common/swiper/swiper.min.js';
        }
        $this->js[] = 'web/js/main.js';
    }
}